/*
 * @descripttion:
 * @author: cp
 * @Date: 2021-04-22 19:45:56
 */
const router = require('koa-router')();

router.get('/', async (ctx, next) => {
  await ctx.render('index', {
    title: 'Hello Koa 2!',
    msg: 123,
  });
});

router.get('/json', async (ctx, next) => {
  const { id } = ctx.request.query;
  ctx.body = {
    title: 'koa2 json',
    viewNum: id,
  };
});

module.exports = router;
